package com.qfjy.homework.Chenqiming;

/**
 * @author:陈启明
 * @date：2022/6/29 19:15
 * @VERSION:1.0
 */

import com.qfjy.homework.renyanlong.Iterator;
import com.qfjy.homework.renyanlong.NameRepository;

/**
 * 使用 NameRepository 来获取迭代器，并打印名字
 */
public class IteratorPatternDemo {

    public static void main(String[] args) {
        com.qfjy.homework.renyanlong.NameRepository namesRepository = new NameRepository();

        for(Iterator iter = namesRepository.getIterator(); iter.hasNext();){
            String name = (String)iter.next();
            System.out.println("Name : " + name);
        }
    }
}
